import { BadRequestException, Injectable, PipeTransform } from '@nestjs/common';
import { UserUpdatePwdDto } from 'src/modules/user/dto/user.dto';

@Injectable()
export class MatchPasswordsPipe implements PipeTransform {
  transform(value: UserUpdatePwdDto) {
    if (value.new_pwd !== value.re_pwd) {
      throw new BadRequestException('新密码和重复密码必须一致');
    }
    return value;
  }
}
